home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / turbovis / tvtoyc01.zip / MODEDLG.H < prev    next >
C/C++ Source or Header  |  1994-01-12  |  3KB  |  144 lines

  1. //-------------------------------------------------------
  2. //
  3. //   modedlg.h: Header file for modedlg.cpp
  4. //
  5. //-------------------------------------------------------
  6.  
  7. #if !defined( __MODEDLG_H )
  8.  
  9. #define __MODEDLG_H
  10.  
  11. #define Uses_TButton
  12. #define Uses_TEvent
  13. #define Uses_TDialog
  14. #define Uses_TLabel
  15. #define Uses_TListBox
  16. #define Uses_TRect
  17. #define Uses_TScrollBar
  18. #define Uses_TStreamable
  19. #define Uses_TStreamableClass
  20. #define Uses_TStringCollection
  21.  
  22. #include <tv.h>
  23. #include "toycfg.h"
  24.  
  25. #if !defined(__TListBoxRec)
  26.   #define __TListBoxRec
  27.   struct TListBoxRec
  28.   {
  29.       TCollection* collection;
  30.       short focused;
  31.   };
  32. #endif
  33.  
  34.  
  35. class TSelectVideoModeDialog : public TDialog
  36. {
  37.  
  38. public:
  39.  
  40.     TSelectVideoModeDialog( );
  41.     TSelectVideoModeDialog( StreamableInit ) :
  42.            TDialog (streamableInit),
  43.            TWindowInit(TSelectVideoModeDialog::initFrame) {};
  44.     virtual void handleEvent( TEvent& );
  45.  
  46.     TListBox *videoListBox;
  47.  
  48.  
  49. private:
  50.  
  51.     virtual const char *streamableName() const
  52.         { return name; }
  53.  
  54. protected:
  55.  
  56.     virtual void write( opstream& );
  57.     virtual void *read( ipstream& );
  58.  
  59. public:
  60.  
  61.     static const char * const name;
  62.     static TStreamable *build();
  63.  
  64. };
  65.  
  66. inline ipstream& operator >> ( ipstream& is, TSelectVideoModeDialog& cl )
  67.     { return is >> (TStreamable&)cl; }
  68. inline ipstream& operator >> ( ipstream& is, TSelectVideoModeDialog*& cl )
  69.     { return is >> (void *&)cl; }
  70. inline opstream& operator << ( opstream& os, TSelectVideoModeDialog& cl )
  71.     { return os << (TStreamable&)cl; }
  72. inline opstream& operator << ( opstream& os, TSelectVideoModeDialog* cl )
  73.     { return os << (TStreamable *)cl; }
  74.  
  75.  
  76.  
  77. typedef
  78.   struct {
  79.     ushort  mode;
  80.     uchar   columns;
  81.     uchar   rows;
  82.     uchar   charHeight;
  83.     Boolean color;
  84.   } ModeDataRec;
  85.  
  86.  
  87. class TVideoList : TStreamable
  88. {
  89.  
  90. protected:
  91.  
  92.    TVideoList(StreamableInit streamableInit) {};
  93.  
  94. public:
  95.  
  96.    static int count;
  97.    static Boolean hasToScan;
  98.    static ModeDataRec modes[maxVideoModes];
  99.    // addMode adds new lines of video mode information to videoList
  100.    static TStringCollection *list;
  101.  
  102.    static void setup();
  103.    static void far addMode(ushort mode, ushort rows, ushort columns,
  104.                  ushort charHeight, Boolean color);
  105.  
  106.    static ushort findSimilarVideoMode(uchar columns, uchar rows, Boolean color);
  107.  
  108. private:
  109.  
  110.     virtual const char *streamableName() const
  111.         { return name; }
  112.  
  113. protected:
  114.  
  115.     virtual void write( opstream& );
  116.     virtual void *read( ipstream& );
  117.  
  118. public:
  119.  
  120.     static const char * const name;
  121.     static TStreamable *build();
  122.  
  123. };
  124.  
  125. inline ipstream& operator >> ( ipstream& is, TVideoList& cl )
  126.     { return is >> (TStreamable&)cl; }
  127. inline ipstream& operator >> ( ipstream& is, TVideoList*& cl )
  128.     { return is >> (void *&)cl; }
  129. inline opstream& operator << ( opstream& os, TVideoList& cl )
  130.     { return os << (TStreamable&)cl; }
  131. inline opstream& operator << ( opstream& os, TVideoList* cl )
  132.     { return os << (TStreamable *)cl; }
  133.  
  134.  
  135.  
  136. void wait(ushort ticks);
  137.  
  138. void selectVideoModeDialog();
  139. void selectVideoMode(TSelectVideoModeDialog *d);
  140.  
  141.  
  142. #endif  // __MODEDLG_H
  143.  
  144.